home *** CD-ROM | disk | FTP | other *** search
/ Champak 143 / (Vol 143) Nov 15 2011.iso / Games / aqua_cubes.swf / scripts / frame_83 / DoAction_7.as < prev    next >
Text File  |  2011-11-15  |  5KB  |  213 lines

  1. function disposeResult(list)
  2. {
  3.    if(_root.gamemode == "survival")
  4.    {
  5.       game.timeOut += list.length * 100 + 50;
  6.    }
  7.    else
  8.    {
  9.       game.point += list.length;
  10.    }
  11. }
  12. function noMoreMove()
  13. {
  14.    trace("noMoreMove");
  15.    _root.gamepause = true;
  16.    fx_no_move.play();
  17. }
  18. function afterNoMove()
  19. {
  20.    trace("afterNoMove");
  21.    if(_root.gamemode == "survival")
  22.    {
  23.       levelTimeOut();
  24.    }
  25.    else
  26.    {
  27.       _root.gamepause = false;
  28.       board.randomBoard();
  29.       ctrl.resetGame();
  30.       fx_no_move.gotoAndPlay(1);
  31.    }
  32. }
  33. function levelTimeOut()
  34. {
  35.    trace("levelTimeOut");
  36.    fx_over.play();
  37.    _root.gamepause = true;
  38. }
  39. function passLevel()
  40. {
  41.    trace("passLevel");
  42.    _root.score += _root.timebonus;
  43.    _root.sp = 100;
  44.    fx_lvclear.play();
  45.    _root.gamepause = true;
  46. }
  47. function nextLevel()
  48. {
  49.    trace("nextLevel");
  50.    _root.level = _root.level + 1;
  51.    if(_root.level >= 9)
  52.    {
  53.       _root.level = 9;
  54.       _root.so.data.enablesurvival = true;
  55.    }
  56.    resetLevel(_root.level);
  57. }
  58. function setLevel(lv)
  59. {
  60.    var _loc3_ = undefined;
  61.    if(lv < 5)
  62.    {
  63.       _loc3_ = 5;
  64.    }
  65.    if(lv >= 5)
  66.    {
  67.       _loc3_ = 6;
  68.    }
  69.    if(_root.gamemode == "survival")
  70.    {
  71.       _loc3_ = 7;
  72.    }
  73.    var _loc4_ = undefined;
  74.    if(lv < 3)
  75.    {
  76.       _loc4_ = 3;
  77.    }
  78.    if(lv >= 3 and lv <= 6)
  79.    {
  80.       _loc4_ = 6;
  81.    }
  82.    if(lv > 6)
  83.    {
  84.       _loc4_ = 9;
  85.    }
  86.    game.playColor = _loc3_;
  87.    game.maxObstruct = _loc4_;
  88.    game.pointTarget = 102 + _root.level * 8;
  89.    game.linkTime = 15;
  90.    game.linkPercent = 9 + lv * 9;
  91. }
  92. function resetLevel(lv)
  93. {
  94.    _root.level = lv;
  95.    game.timeOut = getTimer() + RUNOUT;
  96.    game.point = 0;
  97.    game.linkCreate = false;
  98.    gauge.gotoAndStop(1);
  99.    setLevel(lv);
  100.    bomb.gotoAndStop(1);
  101.    board.randomBoard();
  102.    ctrl.resetGame();
  103. }
  104. stop();
  105. _root.gamepause = false;
  106. _root.systpause = false;
  107. _root.pa_syst._visible = false;
  108. _root.level = 1;
  109. _root.sp = 100;
  110. _root.spMAX = 100;
  111. _root.timebonus = 2160;
  112. _root.score = 0;
  113. removeClip();
  114. _root.fx_over_origin.duplicateMovieClip("fx_over",_root.getNextHighestDepth());
  115. _root.fx_over_origin._visible = false;
  116. _root.fx_lvclear_origin.duplicateMovieClip("fx_lvclear",_root.getNextHighestDepth());
  117. _root.fx_lvclear_origin._visible = false;
  118. _root.sfx_hint = new Sound();
  119. _root.sfx_hint.attachSound("sfx_hint.wav");
  120. _root.onEnterFrame = function()
  121. {
  122.    pauseChecker();
  123.    if(_root.gamemode == "story")
  124.    {
  125.       _root.sholevel = "Level " + _root.level;
  126.       _root.hint._alpha = 10 + _root.sp;
  127.       _root.b_survmenu._visible = false;
  128.    }
  129.    else if(_root.gamemode == "survival")
  130.    {
  131.       _root.sholevel = "Survival Mode";
  132.       _root.hint._visible = false;
  133.       _root.b_survmenu._visible = true;
  134.    }
  135.    if(_root.gamepause == false and _root.systpause == false)
  136.    {
  137.       if(game.pauseAt != undefined)
  138.       {
  139.          game.timeOut += getTimer() - game.pauseAt;
  140.          delete game.pauseAt;
  141.       }
  142.       _root.timebonus = _root.timebonus - 1;
  143.       if(_root.gamemode == "survival")
  144.       {
  145.          if(_root.score >= 500 && game.playColor != 8)
  146.          {
  147.             game.playColor = 8;
  148.          }
  149.          else if(_root.score >= 1000 && game.playColor != 9)
  150.          {
  151.             game.playColor = 9;
  152.          }
  153.       }
  154.       else
  155.       {
  156.          if(game.point > 10)
  157.          {
  158.             game.point -= 0.02;
  159.          }
  160.          _root.gauge.gotoAndStop(Math.floor(game.point * gauge._totalframes / game.pointTarget));
  161.          if(game.point >= game.pointTarget)
  162.          {
  163.             passLevel();
  164.          }
  165.       }
  166.       if(!ctrl.movable)
  167.       {
  168.          trace("--------no move-----------");
  169.          ctrl.movable = true;
  170.          noMoreMove();
  171.       }
  172.       var _loc2_ = game.timeOut - getTimer();
  173.       if(_root.gamemode == "story")
  174.       {
  175.          bomb.gotoAndStop(Math.floor(bomb._totalframes - _loc2_ * bomb._totalframes / RUNOUT));
  176.          if(_loc2_ <= 0)
  177.          {
  178.             levelTimeOut();
  179.          }
  180.       }
  181.       var _loc3_ = Math.floor((RUNOUT - _loc2_) / 1000) % game.linkTime;
  182.       if(!game.linkCreate)
  183.       {
  184.          if(_loc3_ == game.linkTime - 1)
  185.          {
  186.             game.linkCreate = true;
  187.             if(Math.floor(Math.random() * 100) < game.linkPercent)
  188.             {
  189.                trace("link create");
  190.                ctrl.randomLink();
  191.             }
  192.          }
  193.       }
  194.       else if(_loc3_ == 0)
  195.       {
  196.          game.linkCreate = false;
  197.       }
  198.    }
  199.    else if(game.pauseAt == undefined)
  200.    {
  201.       game.pauseAt = getTimer();
  202.    }
  203. };
  204. var RUNOUT = 90000;
  205. if(_root.gamemode == "survival")
  206. {
  207.    resetLevel(_root.survivalstartLV);
  208. }
  209. else
  210. {
  211.    resetLevel(_root.storystartLV);
  212. }
  213.